<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="format-detection" content="telephone=no"/>
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no" />
<meta name="apple-touch-fullscreen" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>获奖查询</title>
<script src="/resources/js/public/mobile-base.js"></script>
<link href="/resources/css/lib/mobile-reset.css" rel="stylesheet" type="text/css"/>
<link href="/resources/css/components/common.css" rel="stylesheet" type="text/css"/>
<link href="/resources/css/pages/form.css" rel="stylesheet" type="text/css"/>

<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?c419481fe5053c40a6e0d1e0e77a25ab";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>


</head>
<body class="pub-bg">
		<!-- <img src="images/public/share-img.jpg" width="0" height="0" class="hide"/> -->
		<div class="info-edit-page owner-edit ">
			<!-- <div class="logo-box">
				<img src="images/public/logo.png" alt ="logo"/>
			</div> -->
			<div class="dealer-edit-cont">
				<div class="dealer-edit-cont-title pub-btn">
					获奖查询
				</div>
				<div class="gift-box pub-cont-box">
					<div class="gift-search-box">
						<input type="text" value="" placeholder="请输入要搜索的销售人员姓名" id="search-key"/>
						<div class="gift-search-btn" id="search-btn">
						</div>
					</div>
					<div class="gift-box-cont">
						<div class="gift-box-cont-tab">
						<table width="100%">
							<thead>
								<tr>
									<td>姓名</td>
									<td>经销商</td>
									<td>抽中奖品</td>
									<td>已推荐人数</td>
								</tr>
							</thead>
							<tbody id="list-box">
							</tbody>
						</table>
						</div>
					</div>
					<div class="gift-list-btn">
						<a href="javascript:history.go(-1);" class="pub-btn gift-btn" >
							返回
						</a>
					</div>
				</div>
				<div class="pub-car-bottom">
				</div>
			</div>
		</div>
    <script src="/resources/js/public/zepto.min.js"></script>
    <script src="/resources/js/public/dialogPrompt.js"></script>
    <script src="/resources/js/public/common.js"></script>
    <script>
    		 $(document).ready(function(){
    			var eleSearchInput = $('#search-key');
    			var eleSearchBtn = $('#search-btn');
    			var eleListBox = $('#list-box');

    			eleSearchBtn.on('click', function(){
    				searchFun();
    			})
    			
    			function searchFun(_type){
    				var searchParam = {};
    				if(!_type){
    					var searchVal = $.trim(eleSearchInput.val());
	    				if(searchVal == ''){
	    					searchParam = {};
	    				} else {
	    					searchParam = {
								name: searchVal
							};
	    				};
    				} else {
    					searchParam = {};
    				}
    				
    				$.ajax({
						type: "get",
						url:  '/getSalePrizeList.htm',
						data: searchParam,
						dataType: "JSON",
						contentType: "application/json;charset=utf-8",
						success: function(data){
							var giftList = [];
							var giftListHtml = '';
							typeof(data) === 'string' ? giftList = JSON.parse(data).data : giftList = data.data;
							if(giftList.length <= 0){
								giftListHtml += '<tr>';
								giftListHtml += '<td colspan="4" style="padding: 3rem 0;">暂无结果</td>';
								giftListHtml += '</tr>';
							}else{
								for(var i= 0;i<giftList.length;i++){
									giftListHtml += '<tr>';
									giftListHtml += '<td>' + giftList[i].saleName + '</td>';
									giftListHtml += '<td>' + giftList[i].storeName + '</td>';
									
									if (giftList[i].prizeDes=='100'){
										giftListHtml += '<td>100元京东卡</td>';
									}else if(giftList[i].prizeDes=='200'){
										giftListHtml += '<td>200元京东卡</td>';
									}else{
										giftListHtml += '<td>未中奖</td>';
									}
									
									
									giftListHtml += '<td>' + giftList[i].recommendCount + '</td>';
									giftListHtml += '</tr>';
								}
								
							}
							eleListBox.html(giftListHtml);
						},
						error: function(){
							eleListBox.html('');
						}
				  	});
    			}
    			searchFun('init');
    		});
    </script>
</body>
</html>